Two selects related in cfform

This is an example of two cfselect related, where the second dropdown depends on the selection of the first one.
In the code shown, when a state is selected, the second dropdown shows the cities in that state.


This is an example of two cfselect related, where the second dropdown depends on the selection of the first one.
In the code shown, when a state is selected, the second dropdown shows the cities in that state.

The code:

if(_global.arrCities == undefined) _global.arrCities = selectCity.dataProvider.slice(0); var arrCities:Array = _global.arrCities; selectCity.removeAll(); for(var i = 0; i < arrCities.length; i++) { var item = arrCities[i].data.split('|'); if(item[1] == selectState.value ) { selectCity.addItem(arrCities[i].label,item[0]); } } selectCity.enabled = (selectCity.length >0) ? true:false;

View the example.
Download the source.